package com.jt.common.collection;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class BlockQueueTests {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<Integer> bq=
                new ArrayBlockingQueue<>(3);
        bq.put(100);
        bq.put(200);
        bq.put(300);
        System.out.println(bq);
        //bq.put(400); 满了阻塞
        bq.take();
        bq.take();
        bq.take();
        System.out.println(bq);
        //bq.take(); 空了阻塞
        System.out.println(bq);
    }
}
